package com.mgr.util;

public class EncryptionNumeric {
	
	public String encoding(String num) {
		String pass = num;
		int i = 0;
		for(i=0;i<pass.length();i++) {
			pass = pass.replace("0", "PQ");
			pass = pass.replace("1", "OW");
			pass = pass.replace("2", "SG");
			pass = pass.replace("3", "LV");
			pass = pass.replace("4", "YE");
			pass = pass.replace("5", "FT");
			pass = pass.replace("6", "MZ");
			pass = pass.replace("7", "DB");
			pass = pass.replace("8", "IX");
			pass = pass.replace("9", "JR");
		}
		return pass;		
	}
	
	public String decoding(String pass) {
		String decode = pass;
		int i = 0;
		for(i=0;i<pass.length()/2;i++) {
			decode = decode.replace("PQ", "0");
			decode = decode.replace("OW", "1");
			decode = decode.replace("SG", "2");
			decode = decode.replace("LV", "3");
			decode = decode.replace("YE", "4");
			decode = decode.replace("FT", "5");
			decode = decode.replace("MZ", "6");
			decode = decode.replace("DB", "7");
			decode = decode.replace("IX", "8");
			decode = decode.replace("JR", "9");
		}
		return decode;		
	}
}
